<?php
class Site_Form_NewMember extends Jnd_Form
{

    public function __construct( $decorateur = "Formulairejnd", $options = null )
    {
        parent::__construct($decorateur, $options);
        $this->setElementDecorators(array(
            "$decorateur"
        ), array(), false);
    }

    public function init()
    {
        $champ = new Zend_Form_Element_Text("username");
        $champ->setLabel(__('Username'));
        $champ->setRequired(true);
        $champs[] = $champ;
        
        $valid = new Jnd_Validate_PasswordConfirmation();
        $champ = new Zend_Form_Element_Password("password");
        $champ->setLabel(__('Password'));
        $champ->setRequired(true);
        $champ->addValidator($valid, false);
        $champs[] = $champ;

        $champ = new Zend_Form_Element_Password("confirmPassword");
        $champ->setLabel(__('Confirm password'));
        $champ->setRequired(true);
        $champ->addValidator($valid);
        $champs[] = $champ;
        
        $champ = new Zend_Form_Element_Text("email");
        $champ->setLabel(__('Mail'));
        $champ->setRequired(true);
        $champs[] = $champ;
        
        $champ = new Zend_Form_Element_Submit("submit");
        $champ->setValue(__("Register"));
        $champ->setRequired(true);
        $champ->setAttribs(array(
        	"class" => "button"	
        ));
        $champs[] = $champ;
        
        $this->addElements($champs);
        $this->setName("newMember");
        $this->setAction($this->getView()->smartUrl("panel", "index", "site"));
    }
    
    public function isValid($data) {
    	$valid = parent::isValid($data);
    	return $valid;
    }

}